#include "StdAfx.h"
#include "DResourceManagerSFML.h"
#include <SFML/Graphics.hpp>
#include "../Engine/DImage.h"

DResourceManagerSFML::DResourceManagerSFML(void)
{
}

DResourceManagerSFML::~DResourceManagerSFML(void)
{
}

boost::shared_ptr<DImage> DResourceManagerSFML::loadImage(const std::string& strImagePath, bool bIsBackground /*= false*/)
{
    boost::shared_ptr<sf::Image> sfImage(new sf::Image);
    sfImage->LoadFromFile(strImagePath);

    // this solves the problem with flickering line between two tiles when they scrolls
    if(bIsBackground)
    {
        sfImage->SetSmooth(false);
    }

    if(sfImage)
    {
        return boost::shared_ptr<DImage>(new DImageSFML(sfImage));
    }
    else
    {
        return boost::shared_ptr<DImage>();
    }
}